home *** CD-ROM | disk | FTP | other *** search
/ Alles Voor Internet / Tout Pour Internet / alles voor internet.iso / MacInternet™ / Telnet / Terminal 2.2 / Project / Sources / Main.h < prev    next >
Text File  |  1992-01-17  |  9KB  |  227 lines

  1. /*
  2.     Terminal 2.2
  3.     "Main.h"
  4. */
  5.  
  6. #define    MENUBAR        128
  7. #define    APPLE        128
  8. #define     ABOUT        1
  9. #define    FILE        129
  10. #define        SCREEN        1        /* Save screen buffer... */
  11. #define     CAPTURE        2        /* Text capture... */
  12. #define        SEND        3        /* Text send... */
  13. #define     RECEIVE        5        /* File receive... */
  14. #define     TRANSMIT    6        /* File send... */
  15. #define        MAKE        8        /* Make MacBinary file... */
  16. #define        EXTRACT        9        /* Extract MacBinary file... */
  17. #define        KISS        10        /* Kiss script file... */
  18. #define        QUIT        12
  19. #define EDIT        130
  20. #define        UNDO        1
  21. #define        CUT            3
  22. #define     COPY        4
  23. #define     PASTE        5
  24. #define     CLEAR        6
  25. #define        RESET        8        /* Clear capture buffer */
  26. #define        SHOWPW        9        /* Show progress window */
  27. #define        DEBLOCK        11        /* Deblock send */
  28. #define        DTRDROP        12        /* Drop DTR */
  29. #define        DTRASSERT    13        /* Assert DTR */
  30. #define        CTSCHECK    14        /* Check CTS */
  31. #define    OPTIONS        131
  32. #define        PORT        1        /* Communication port settings... */
  33. #define        TEXTSEND    2        /* TEXT file send options... */
  34. #define        TERMINAL    3        /* Terminal options... */
  35. #define        OTHER        4        /* Other options... */
  36. #define        TRANSFER    5        /* File transfer options... */
  37. #define        XYOPTIONS    6        /* XY-Modem options... */
  38. #define        ZOPTIONS    7        /* Z-Modem options... */
  39. #define SCRIPT        132
  40. #define        DOSCRIPT    1        /* Execute script... */
  41. #define        SCRIPT1        3        /* First script */
  42. #define MACRO        133
  43. #define        DOMACRO        1        /* Execute macro... */
  44. #define        DOMACRO1    3        /* First macro */
  45.  
  46. #define ALRT_ERROR        128        /* Error alert */
  47. #define DLOG_ABOUT        129        /* About dialog */
  48. #define DLOG_TERMINAL    130        /* Terminal options dialog */
  49. #define DLOG_PROGRESS    131        /* Progress dialog */
  50. #define DLOG_PORT        132        /* Communication port settings dialog */
  51. #define DLOG_XYMODEM    133        /* XY-Modem options dialog */
  52. #define DLOG_SEND        134        /* TEXT file send options dialog */
  53. #define DLOG_OTHER        135        /* Other options dialog */
  54. #define DLOG_ZMODEM        136        /* Z-Modem options dialog */
  55. #define DLOG_TRANSFER    137        /* File transfer options dialog */
  56.  
  57. #define RECORD        1024        /* Size of capture file record */
  58. #define SETTINGS    0x0220        /* Version of settings structure */
  59.  
  60. #define ACTIVE        (outline + bold + extend)
  61.  
  62. #define FINE        0        /* No error */
  63. #define TIMEOUT        1        /* Timeout error */
  64. #define CANCEL        2        /* Cancel by button or menu */
  65. #define ABORT        3        /* Abort by ctrl-X received */
  66. #define ERROR        4        /* Other error */
  67.  
  68. #define USECTB        /* Use Communications Toolbox if available */
  69.  
  70. typedef struct {
  71.     WindowRecord    window;
  72.     Rect            messRect;    /* Message rectangle */
  73.     ControlHandle    messOk;        /* "Ok" button */
  74.     Byte            mess[256];    /* Message */
  75.     Rect            rect;        /* Rx display rectangle */
  76.     Point            cursor0;    /* First cursor position in rx rectangle */
  77.     Point            cursor;        /* Current rx cursor position */
  78.     unsigned short    height;        /* Line height */
  79.     Rect            character;    /* Character enclosing rectangle */
  80.     ControlHandle    vs;            /* Vertical scroll bar */
  81.     unsigned short    linesPage;    /* Number of lines per page */
  82.     TextRecord        buf;        /* Circular capture buffer */
  83.     short            file;        /* Text capture file reference */
  84.     short            volume;        /* Text capture volume reference */
  85.     long            length;        /* Current length in record */
  86.     Byte        record[RECORD];    /* Capture file record */
  87. } DocumentRecord, *DocumentPeek;
  88.  
  89. typedef struct {
  90.     unsigned short    crc;        /* To check if options are valid */
  91.     unsigned short    version;    /* Version of options structure */
  92.     short        dirty;            /* If options were modified */
  93.  
  94.     /* Communication options */
  95.  
  96.     Byte        portName[256];    /* What port to use */
  97.     short        portSetup;        /* Serial port setup */
  98.     short        handshake;        /* Handshake */
  99.     short        dropDTR;        /* Dont' drop DTR when quitting */
  100.  
  101.     /* TEXT file send options */
  102.  
  103.     Byte        prompt[12];        /* Prompt string */
  104.     long        linedelay;        /* Line delay (ticks) */
  105.     long        chardelay;        /* Character delay (ticks) */
  106.  
  107.     /* Binary file transfer options */
  108.  
  109.     short        Binary;            /* Use and recognize MacBinary */
  110.     Byte        volumeName[28];    /* Volume name (down- & uploads) */
  111.     short        volume;            /* Volume reference (down- & uploads) */
  112.     long        directory;        /* Directory id (down- & uploads) */
  113.     short        protocol;        /* Enable CIS-B file transfer protocol */
  114.     short        ZModem;            /* Use ZModem (else use XYModem) */
  115.     short        ZAutoReceive;    /* Z-Modem: auto receive */
  116.  
  117.     /* XYModem options */
  118.  
  119.     long        XModemtimeout;    /* XModem: timeout (ticks) */
  120.     short        XModemCRC;        /* XModem: use and recognize CRC */
  121.     short        XModem1K;        /* Xmodem: use and recognize 1K blocks */
  122.     short        batch;            /* Y-Modem batch mode */
  123.  
  124.     /* ZModem options */
  125.  
  126.     short        ZEscapeCtl;        /* Z-Modem: escape all control characters */
  127.     long        ZTimeout;        /* Z-Modem: receive timeout (ticks) */
  128.     long        ZBuffer;        /* Z-Modem: receive buffer size (bytes) */
  129.     long        ZRetries;        /* Z-Modem: receive maximum retries */
  130.     long        ZPacket;        /* Z-Modem: transmit sub-packet length (Bytes) */
  131.     long        ZWindow;        /* Z-Modem: transmit window size (Bytes) */
  132.     long        Zcrcq;            /* Z-Modem: transmit ZCRCQ spacing (Bytes) */
  133.  
  134.     /* Terminal options */
  135.  
  136.     short         localEcho;        /* Local echo flag */
  137.     short        echo;            /* Echo received characters */
  138.     short        autoLF;            /* Insert LF after each CR sent */
  139.     short        save;            /* Save and display received characters */
  140.     short        scriptVolume;    /* Volume reference (script files) */
  141.     long        scriptDirectory;/* Directory id (script files) */
  142.     Byte        startVName[28];    /* Volume name (autostart script file) */
  143.     short        startVolume;    /* Volume reference (autostart script file) */
  144.     long        startDirectory;    /* Directory id (autostart script file) */
  145.     Byte        startName[32];    /* Autostart script file name */
  146.  
  147.     /* Other options */
  148.  
  149.     long        textCreator;    /* TEXT file creator */
  150.     long        binType;        /* Non-MacBinary file type */
  151.     long        binCreator;        /* Non-MacBinary file creator */
  152.     Byte        backspace;        /* Code for backspace key */
  153.     Byte        escape;            /* Code for ` key */
  154.     short        beep;            /* Accept control-G as beep */
  155.     short        ctrl;            /* Control key */
  156.  
  157.     /* Window positions */
  158.     
  159.     Point        terminalWindow;    /* Terminal window */
  160.     Point        progressWindow;    /* Progress window */
  161. } Options;
  162.  
  163. typedef struct {
  164.     short        icon;            /* Application 'ICN#' id (128) */
  165.     short        version;        /* Resource id of version data (0) */
  166.     long        signature;        /* Application signature ('ET_T') */
  167.     long        otype;            /* Options file type ('ET_O') */
  168.     long        btype;            /* MacBinary file type ('ET_B') */
  169.     long        stype;            /* Script file type ('TEXT') */
  170.     long        ztype;            /* Z-modem partial file ('ET_Z') */
  171. } Types;
  172.  
  173. typedef struct {        /* 'CNFG' (configuration) resource */
  174.     short font;            /* Font number (should be monospaced) */
  175.     short size;            /* Font size */
  176.     short lines;        /* Lines in terminal window */
  177.     short columns;        /* Columns in terminal window */
  178.     long buffer;        /* Size of terminal buffer (bytes) */
  179.     long input;            /* Size of serial input buffer (bytes) */
  180.     long output;        /* Size of serial output buffer (bytes) */
  181.     long script;        /* Size of script memory (bytes) */
  182.     Byte fontname[];    /* Font name (should be monospaced) */
  183. } Configuration;
  184.  
  185. #define HiWrd(a)    (((a) >> 16) & 0xFFFF)
  186. #define LoWrd(a)    ((a) & 0xFFFF)
  187. #define Max(a,b)    ((a) > (b) ? (a) : (b))
  188. #define Min(a,b)    ((a) < (b) ? (a) : (b))
  189.  
  190. #define Transfer_Rx        1        /* File transfer, reception */
  191. #define Transfer_Tx        2        /* File transfer, transmission */
  192. #define Transfer_B        3        /* File transfer, Quick-B */
  193.  
  194. extern SysEnvRec        Mac;            /* Machine information */
  195. extern Boolean            WNE;            /* WaitNextEvent() flag */
  196. extern Boolean            Background;        /* In background flag */
  197. extern DocumentPeek        TerminalWindow;    /* Terminal window */
  198. extern Options            Settings;        /* Current options */
  199. extern Byte                EmptyStr[];        /* Often needed empty string */
  200. extern OSType            TEXT;            /* Text file type */
  201. extern Handle            KCHR;            /* 'KCHR' resource */
  202. extern Types            Application;    /* Signature information */
  203. extern Boolean            Abort;            /* Abort flag */
  204. extern Boolean            Busy;            /* Transmit in progress flag */
  205. extern short            SendFileRef;    /* Send file reference number */
  206. extern Boolean            Sending;        /* Sending in progress */
  207. extern short            Transfer;        /* File transfer in progress */
  208. extern Configuration    Config;            /* Configuration parameters */
  209. extern Boolean            Control_X;        /* Control-X abort flag */
  210. extern Handle            MacrosText;        /* Macros text */
  211. extern Boolean            MFmemory;        /* MultiFinder temporary memory */
  212. extern Boolean            DTR;            /* Current state of DTR output */
  213. #ifdef USECTB
  214. extern Boolean            CTB;            /* Communications Tool Box flag */
  215. #endif
  216.  
  217. void About (short);
  218. void CheckEvents (void);
  219. pascal void Crash (void);
  220. void DoEvent (EventRecord *);
  221. void Error (short, Byte *);
  222. Boolean IsDocument (WindowPtr);
  223. Boolean IsSystem (WindowPtr);
  224. short Loop (long, Byte *, short);
  225. short LoopBuffer(long, Byte *, long);
  226. Boolean Init (void);
  227.